/**
 * 
 */

function checkExistMenuFoodName() {
		var urlAjax = "/core-web-admin/menufood/isexisted";
		$.ajax ({
			"url" : urlAjax,
			"data" : {
				menuFoodName : document.forms["menufood"]["menuFoodName"].value
			},
			"success" : function(data) {
				if (data == "true") {
					alert("Hello abc");
					return false;
				}
				if (data == "false") {
					alert("hello false hj");
					return false;
				}
				alert("hello1");
			},
			"error" : function(data) {
				alert("error");
			}
		});
		if (menuFoodName != null && menuFoodName != "" && checkExistMenuFoodName()) {
			textError = "Menufood name has existed!";
			addElements(div, textError);
			check = false;
		}
		return false;
	}


function checkExistMenuFoodName() {
	$.ajax ({
		"type" : "GET",
		"url" : "/core-web-admin/menufood/isexisted",
		"data" : {
			"restaurantId" : $('#restaurantId').val(),
			"menuFoodName" : $('#menuFoodName').val()
		},
		"success" : function(data) {
			if (data == "true") {
				return true;
			}
			if (data == "false") {
				return false;
			}
		},
		"error" : function(data) {
			alert("ERROR WHEN CHECK EXISTED MENU FOOD NAME!");
			return false;
		}
	});
}